package day2;

import java.io.*;

//通过缓冲流 + 新版try-catch实现文件复制
public class TestCopy3 {
    public static void main(String[] args) {
        try(FileInputStream fis = new FileInputStream("d://io//2025.0623.mp4");
            FileOutputStream fos = new FileOutputStream("d://io//movie//new3_2025.0623.mp4");
            BufferedInputStream bis = new BufferedInputStream(fis);
            BufferedOutputStream bos = new BufferedOutputStream(fos);){
            long start = System.currentTimeMillis();
            byte [] bs = new byte[1024];
            int len = 0;
            while ((len=bis.read(bs))!=-1){
                bos.write(bs,0,len);
            }
            long end = System.currentTimeMillis();
            System.out.println((end-start)+"ms");
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
